package ooday03;
/** 测试类 */
public class Test {
    public static void main(String[] args) {

        Dog[] dogs=new Dog[3];
        dogs[0]=new Dog("阿芬",50,"非洲黑");
        dogs[1]=new Dog("吞吞",4,"白");
        dogs[2]=new Dog("小黄",1,"黄");
        System.out.println(dogs[0].name);//输出第一只狗狗的名字
        dogs[1].age=5;//修改第二只狗狗的年龄
        dogs[2].swim();//输出第三只狗狗在游泳
        for(int i=0;i<dogs.length;i++){//遍历数组
            System.out.println(dogs[i].name);//输出每个狗狗的名字，遍历数组的每一个名字
            dogs[i].eat();//输出每吃狗狗都在吃饭
        }
        Chick[] chicks=new Chick[2];
        chicks[0]=new Chick("小花",5,"粉");
        chicks[1]=new Chick("小绿",3,"绿");
        for(int i=0;i<chicks.length;i++){
            System.out.println(chicks[i].name);
            chicks[i].eat();
        }
        Fish[] fish =new Fish[4];
        fish[0]=new Fish("阿花",6,"黑");
        fish[1]=new Fish("阿黑",2,"白");
        fish[2]=new Fish("阿姨",4,"绿");
        fish[3]=new Fish("阿银",3,"黄");
        for (int i=0;i<fish.length;i++){
            System.out.println(fish[i].name+","+fish[i].age+","+fish[i].color);
            fish[i].swim();
            fish[i].eat();
        }
        














//        Dog dog = new Dog("小黑",2,"黑");
//        dog.eat();
//        dog.drink();
//        dog.lookHome();
//        dog.swim();
//
//        Chick chick = new Chick("花花",3,"棕");
//        chick.eat();
//        chick.drink();
//        chick.layEggs();
//
//        Fish fish = new Fish("金金",1,"黄");
//        fish.eat();
//        fish.drink();
//        fish.swim();
    }
}




















